package com.android.pagemarket.business.model;

import java.util.ArrayList;
import java.util.List;

import org.json.JSONArray;
import org.json.JSONObject;

public class PaperType
{
    /////////////////////////////////////////////////////
    // 协议参数
    public String paperName;// 是 C 纸型名称
    public List<Paper> paperList;// 否 Array 单坑列表
    public boolean isChecked;
    
    public static PaperType parse(JSONObject data) throws Exception
    {
        PaperType one = new PaperType();
        one.paperName = data.getString("paperName");
        if (!data.isNull("paperList"))
        {
            JSONArray list = data.getJSONArray("paperList");
            int size = list.length();
            if (size > 0)
            {
                one.paperList = new ArrayList<Paper>(size);
                for (int i = 0; i < size; i++)
                {
                    one.paperList.add(Paper.parse(list.getJSONObject(i)));
                }
            }
        }
        return one;
    }
}